NVelocity
Class Template

This class is used for controlling all template operations. This class uses a parser created by JavaCC to create an AST that is subsequently traversed by a Visitor. * Template template = Velocity.getTemplate("test.wm"); Context context = new VelocityContext(); * context.put("foo", "bar"); context.put("customer", new Customer()); * template.merge(context, writer); *

Fields inherited from class NVelocity.Runtime.Resource.Resource
data, encoding, lastModified, modificationCheckInterval, name, nextCheck, resourceLoader, rsvc

Constructor Summary
Template()
        Default constructor

Properties inherited from class NVelocity.Runtime.Resource.Resource
Data, Encoding, LastModified, ModificationCheckInterval, Name, ResourceLoader, RuntimeServices

Method Summary
void InitDocument()
         initializes the document. init() is not longer dependant upon context, but we need to let the init() carry the template name down throught for VM namespace features
void Merge(NVelocity.Context.IContext context, System.IO.TextWriter writer)
         The AST node structure is merged with the context to produce the final output. * Throws IOException if failure is due to a file related issue, and Exception otherwise *
bool Process()
         gets the named resource as a stream, parses and inits *

Methods inherited from class NVelocity.Runtime.Resource.Resource
IsSourceModified, RequiresChecking, Touch

Methods inherited from class System.Object
Equals, Finalize, GetHashCode, GetType, MemberwiseClone, ToString


Constructor Detail

Template

public Template()

Default constructor

Method Detail

InitDocument

public void InitDocument()

initializes the document. init() is not longer dependant upon context, but we need to let the init() carry the template name down throught for VM namespace features


Merge

public void Merge(NVelocity.Context.IContext context,
                  System.IO.TextWriter writer)

The AST node structure is merged with the context to produce the final output. * Throws IOException if failure is due to a file related issue, and Exception otherwise *

Parameters:
context - Conext with data elements accessed by template
writer - output writer for rendered template @throws ResourceNotFoundException if template not found from any available source. @throws ParseErrorException if template cannot be parsed due to syntax (or other) error. @throws Exception anything else.

Process

public bool Process()

gets the named resource as a stream, parses and inits *

Returns:
true if successful @throws ResourceNotFoundException if template not found from any available source. @throws ParseErrorException if template cannot be parsed due to syntax (or other) error. @throws Exception some other problem, should only be from initialization of the template AST.